home *** CD-ROM | disk | FTP | other *** search
/ Network PC / Network PC.iso / amiga utilities / communication / internet / amitcp3.0b / src.lha / src / appl / askhost / amiga.c next >
Encoding:
C/C++ Source or Header  |  1996-09-08  |  1.3 KB  |  66 lines

  1. /*
  2.  * $Id: amiga.c,v 1.1 1994/02/02 17:48:57 too Exp $
  3.  *
  4.  * Author: Tomi Ollila <too@cs.hut.fi>
  5.  *
  6.  * Copyright (c) 1993, 1994  AmiTCP/IP Group, <amitcp-group@hut.fi>
  7.  *                           Helsinki University of Technology, Finland.
  8.  *                           All rights reserved.
  9.  *
  10.  * Created: Tue Aug  3 19:38:51 1993 too
  11.  * Last modified: Wed Mar  2 16:38:23 1994 too
  12.  *
  13.  * HISTORY
  14.  * $Log: amiga.c,v $
  15.  * Revision 1.1  1994/02/02  17:48:57  too
  16.  * Initial revision
  17.  *
  18.  */
  19.  
  20. #include <exec/types.h>
  21. #include <exec/libraries.h>
  22.  
  23. #include <dos/dos.h>
  24.  
  25. #include "amiga.h"
  26.  
  27. #include <proto/exec.h>
  28. #include <proto/dos.h>
  29. #include <proto/socket.h>
  30.  
  31. #include <stdlib.h>
  32.  
  33. #include "amitcp/socketbasetags.h"
  34.  
  35. struct DosLibrary * DOSBase;
  36.  
  37. struct Library * SocketBase = NULL;
  38.  
  39. void _STIstart(void)
  40. {
  41.   if ((DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 36)) == NULL)
  42.     exit(20);
  43.  
  44.   if ((SocketBase = OpenLibrary("bsdsocket.library", 2)) == NULL) {
  45.     Printf("Can not open bsdsocket.library\n");
  46.     CloseLibrary((struct Library *)DOSBase);
  47.   }
  48. }
  49.  
  50. void _STDend(void)
  51. {
  52.   CloseLibrary(SocketBase);
  53.   CloseLibrary((struct Library *)DOSBase);
  54. }
  55.  
  56. void herror(char * banner)
  57. {
  58.   LONG * str;
  59.  
  60.   (void)SocketBaseTags(SBTM_GETREF(SBTC_HERRNO),    &str,
  61.                SBTM_GETREF(SBTC_HERRNOSTRPTR),    &str,
  62.                TAG_DONE,            0);
  63.   
  64.   Printf("%s: %s\n", banner, (char *)str);
  65. }
  66.